package service

import (
	"context"
	"gitee.com/kelvins-io/kelvins-template-consumer/util/email"
	"gitee.com/kelvins-io/kelvins-template-consumer/vars"
	"log"
	"strings"
)

func NoticeConsume(ctx context.Context, body string) error {
	if vars.EmailConfigSetting != nil && vars.EmailConfigSetting.Enable {
		err := email.SendEmailNotice(context.TODO(), strings.Join(vars.EmailNoticeSetting.Receivers, ","), "kelvins-template-consumer", "kelvins-template-consumer NoticeConsume "+body)
		if err != nil {
			log.Printf("send email to(%+v) err %v\n", vars.EmailNoticeSetting, err)
		}
	}

	return nil
}

func NoticeConsumeErr(ctx context.Context, err, body string) error {
	return nil
}
